home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / hity wydania / Ubuntu 9.10 PL / karmelkowy-koliberek-desktop-9.10-i386-PL.iso / casper / filesystem.squashfs / etc / acpi / rotatescreen.sh < prev    next >
Linux/UNIX/POSIX Shell Script  |  2009-10-13  |  734b  |  32 lines

  1. #!/bin/sh
  2. #
  3. # This script rotates the display in TabletPCs when screen is changed from
  4. # laptop to tablet mode, or when rotation button is pressed
  5.  
  6. test -f /usr/share/acpi-support/key-constants || exit 0
  7.  
  8. . /usr/share/acpi-support/power-funcs
  9.  
  10. if [ -f /var/lib/acpi-support/screen-rotation ] ; then
  11.   ROTATION=`cat /var/lib/acpi-support/screen-rotation`
  12. fi
  13.  
  14. case "$ROTATION" in
  15.     right)
  16.     NEW_ROTATION="normal"
  17.     ;;
  18.     *)
  19.     NEW_ROTATION="right"
  20.     ;;
  21. esac
  22.  
  23. for x in /tmp/.X11-unix/*; do
  24.     displaynum=`echo $x | sed s#/tmp/.X11-unix/X##`
  25.     getXconsole;
  26.     if [ x"$XAUTHORITY" != x"" ]; then
  27.         export DISPLAY=":$displaynum"           
  28.         /usr/bin/xrandr -o $NEW_ROTATION && echo $NEW_ROTATION > /var/lib/acpi-support/screen-rotation
  29.     fi
  30. done
  31.  
  32.